// 请求响应参数（不包含data）
export interface Result {
  errorCode: string;
  error: string;
  time: string;
}

// 请求响应参数（包含data）
export interface ResultData<T = any> extends Result {
  data: T;
}

// 分页响应参数
export interface ResPage<T> {
  rows: T[];
  //总条数
  totalSize: number;
  //总页数
  totalPage: number;
}

// 分页请求参数
export interface ReqPage {
  page: number;
  pageSize: number;
}

// 文件上传模块
export namespace Upload {
  export interface ResFileUrl {
    src: string;
    showUrl: string;
  }
}

// 登录模块
export namespace Login {
  export interface ReqLoginForm {
    username: string;
    password: string;
    captcha: string;
    captchaKey: string;
  }
  export interface ResLogin {
    token: string;
    nickName: string;
    menu: [];
    button: {};
  }
  export interface ResAuthButtons {
    [key: string]: string[];
  }
}

// 用户管理模块
export namespace User {
  export interface ReqUserParams extends ReqPage {
    username: string;
    gender: number;
    idCard: string;
    email: string;
    address: string;
    createTime: string[];
    status: number;
  }
  export interface ResUserList {
    id: string;
    username: string;
    gender: number;
    user: { detail: { age: number } };
    idCard: string;
    email: string;
    address: string;
    createTime: string;
    status: number;
    avatar: string;
    photo: any[];
    children?: ResUserList[];
  }
  export interface ResStatus {
    userLabel: string;
    userValue: number;
  }
  export interface ResGender {
    genderLabel: string;
    genderValue: number;
  }
  export interface ResDepartment {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
  export interface ResRole {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
}

//系统管理
export namespace System {
  //权限资源树
  export interface SystemResourceTree {
    id: number;
    parentId: number;
    name: string;
    rightKey: string;
    isMenu: number;
    children: SystemResourceTree[];
  }

  //保存权限节点的参数
  export interface SaveSystemResource {
    id: number;
    parentId: number;
    name: string;
    rightKey: string;
    isMenu: number;
  }

  //角色列表请求参数
  export interface AdminRoleParams extends ReqPage {
    name: string;
    status: string;
  }

  //角色列表返回参数
  export interface AdminRole {
    id: number;
    name: string;
    status: number;
    createdAt: string;
    updatedAt: string;
  }
  //角色详情
  export interface AdminRoleInfo {
    id: number;
    name: string;
    status: number;
    rightsList: string;
    rightsListArr: string[];
  }

  //管理员列表参数
  export interface AdminUserParams extends ReqPage {
    adminName: string;
    status: number;
    nickName: string;
  }
  //管理员列表返回参数
  export interface AdminUser {
    id: number;
    adminName: string;
    nickName: string;
    loginNum: number;
    lastLoginAt: string;
    lastLoginIp: string;
    status: number;
    roleId: number;
    roleName: string;
    createdAt: string;
    updatedAt: string;
    password: string;
  }
}

//系统支撑
export namespace Support {
  //字典类型请求参数
  export interface DictTypeParams extends ReqPage {
    dictName: string;
  }
  //字典类型列表
  export interface DictType {
    dictId: number;
    dictName: string;
    dictType: string;
    remark: string;
    createdAt: string;
    updatedAt: string;
  }
  //字典值请求参数
  export interface DictDataParams extends ReqPage {
    dictType: string;
  }
  //字典值
  export interface DictData {
    dictCode: number;
    dictSort: number;
    dictLabel: string;
    dictValue: string;
    dictType: string;
    remark: string;
    createdAt: string;
    updatedAt: string;
  }
  //字典值下拉
  export interface DictDataSelect {
    dictLabel: string;
    dictValue: string;
  }

  //系统日志请求参数
  export interface OperationLogParams extends ReqPage {
    username: string;
    module: string;
    operType: string;
  }
  //系统日志
  export interface OperationLog {
    id: number;
    userId: number;
    username: string;
    module: string;
    operType: string;
    ip: string;
    userAgent: string;
    os: string;
    createdTime: string;
  }

  //系统配置请求参数
  export interface Config {
    id: number;
    configName: string;
    configKey: string;
    configValue: string;
    configDesc: string;
  }
}

//营销管理
export namespace Market {
  //友情链接请求参数
  export interface FriendLinkParams extends ReqPage {
    name: string;
  }
  //友情链接
  export interface FriendLink {
    id: number;
    name: string;
    link: string;
    sort: number;
    createdAt: string;
    updatedAt: string;
  }

  //广告位请求参数
  export interface AdvPositionParams extends ReqPage {
    name: string;
  }
  //广告位
  export interface AdvPosition {
    id: number;
    name: string;
    code: string;
    width: number;
    height: number;
    createdAt: string;
    updatedAt: string;
  }

  //广告位请求参数
  export interface AdvParams extends ReqPage {
    name: string;
    positionCode: string;
  }
  //广告位
  export interface Adv {
    id: number;
    name: string;
    positionCode: string;
    link: string;
    content: string;
    contentShow: string;
    startTime: string;
    endTime: string;
    createdAt: string;
    updatedAt: string;
  }
}

//内容管理
export namespace Cms {
  //帮助中心请求参数
  export interface HelpCenterParams extends ReqPage {
    name: string;
  }
  //帮助中心
  export interface HelpCenter {
    id: number;
    name: string;
    code: string;
    content: string;
    createdAt: string;
    updatedAt: string;
  }
  //文章分类请求参数
  export interface ArticleCateParams extends ReqPage {
    name: string;
  }
  //文章分类
  export interface ArticleCate {
    id: number;
    name: string;
    code: string;
    status: number;
    sort: number;
    createdAt: string;
    updatedAt: string;
  }
  //文章请求参数
  export interface ArticleParams extends ReqPage {
    name: string;
    cateCode: string;
  }
  //文章列表
  export interface ArticleList {
    id: number;
    cateCode: string;
    name: string;
    author: string;
    img: string;
    status: number;
    sort: string;
    createdAt: string;
    updatedAt: string;
  }
  //文章详情
  export interface ArticleInfo {
    id: number;
    cateCode: string;
    name: string;
    author: string;
    img: string;
    status: number;
    sort: number;
    brief: string;
    seoKeywords: string;
    seoDescription: string;
    content: string;
    imageShow: string;
  }
}
